package com.uniledger.exchange.home;

import android.app.Activity;

import com.uniledger.exchange.R;
import com.uniledger.exchange.home.scheme.ExchangeActivity;
import com.uniledger.exchange.home.scheme.TopUpActivity;
import com.uniledger.exchange.home.scheme.TransferActivity;
import com.uniledger.exchange.home.scheme.WithdrawActivity;
import com.uniledger.exchange.model.StellarAsset;

import java.util.ArrayList;
import java.util.List;

public class HomeCenter {

    public static final int TYPE_HOME_HEAD = 0;
    public static final int TYPE_HOME_ASSET = 1;
    public static final int TYPE_HOME_SCHEME = 2;
    public static final int TYPE_HOME_LINE = 3;

    public static final int SCHEME_TRANSFER = 0;
    public static final int SCHEME_EXCHANGE = 1;
    public static final int SCHEME_TOP_UP = 2;
    public static final int SCHEME_WITHDRAW = 3;
    public static final int SCHEME_PAYMENT = 4;


    public String name;
    public int icon;
    public int type;
    public int scheme;
    public int arrow;

    public List<String> list;

    /**
     * 是否隐藏资产明细
     */
    public boolean isHide;

    //资产
    public List<StellarAsset> uniAsset;

    @Override
    public String toString() {
        return "HomeCenter{" +
                "name='" + name + '\'' +
                ", icon='" + icon + '\'' +
                ", type=" + type +
                '}';
    }

    public HomeCenter(List<StellarAsset> uniAsset) {
        this.uniAsset = uniAsset;
        this.type = TYPE_HOME_ASSET;
        this.isHide = false;
        this.arrow = R.drawable.ic_home_arrow;

    }

    public HomeCenter(String name, int icon) {
        this.name = name;
        this.icon = icon;
        this.type = TYPE_HOME_SCHEME;
        this.arrow = R.drawable.ic_home_arrow;
    }

    public HomeCenter(String name, int icon, int scheme) {
        this.name = name;
        this.icon = icon;
        this.scheme = scheme;
        this.type = TYPE_HOME_SCHEME;
        this.arrow = R.drawable.ic_home_arrow;
    }

    public HomeCenter(int type) {
        this.type = type;
        this.arrow = R.drawable.ic_home_arrow;
        this.list = new ArrayList<>();
        list.add("支持跨境支付");
        list.add("费用极低");
        list.add("速度极快");
    }

    public void click(Activity activity) {
        if (type == TYPE_HOME_HEAD) {

        } else if (type == TYPE_HOME_ASSET) {

        } else if (type == TYPE_HOME_SCHEME) {
            switch (scheme) {
                case SCHEME_TRANSFER:
                    TransferActivity.start(activity, TransferActivity.TRANSFER_USER);
                    break;
                case SCHEME_EXCHANGE:
                    ExchangeActivity.start(activity);
                    break;
                case SCHEME_TOP_UP:
                    TopUpActivity.start(activity);
                    break;
                case SCHEME_WITHDRAW:
                    WithdrawActivity.start(activity);
                    break;
                default:
                    break;
            }

        } else {
            //TODO TYPE_HOME_LINE

        }
    }


}
